package com.eco.fanliapp.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eco.fanliapp.entity.AppGoods;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * 商品主 数据层
 *
 * @author xiaoxx
 * @date 2019-04-25
 */
public interface AppGoodsMapper extends BaseMapper<AppGoods> {
    /**
     * 查询商品主信息
     *
     * @param tableId 商品主ID
     * @return 商品主信息
     */
    AppGoods selectAppGoodsById(Long tableId);

    /**
     * 根据商品id查询商品详情
     *
     * @param itemId
     * @return
     */
    AppGoods findAppGoodsByItemId(String itemId);

    /**
     * 查询商品主列表
     *
     * @param appGoods 商品主信息
     * @return 商品主集合
     */
    List<AppGoods> selectAppGoodsList(AppGoods appGoods);

    /**
     * 新增商品主
     *
     * @param appGoods 商品主信息
     * @return 结果
     */
    int insertAppGoods(AppGoods appGoods);

    /**
     * 修改商品主
     *
     * @param appGoods 商品主信息
     * @return 结果
     */
    int updateAppGoods(AppGoods appGoods);

    int updateAppGoodsByItemId(AppGoods appGoods);

    int updateTkmoney(AppGoods appGoods);//修改固定返

    /**
     * 删除商品主
     *
     * @param tableId 商品主ID
     * @return 结果
     */
    int deleteAppGoodsById(Long tableId);

    /**
     * 批量删除商品主
     *
     * @param tableIds 需要删除的数据ID
     * @return 结果
     */
    int deleteAppGoodsByIds(String[] tableIds);

    int updateAppGoodsByIds(String[] tableIds);

    int deleteAppGoodsByItemid(String[] itemIds);

    int deleteAppGoodsByItemidNew(String itemId);

    List<AppGoods> selectAppGoodsListLIMIT100(@Param("start") Long start, @Param("end") Long end);

    List<AppGoods> selectAppGoodsListAll(@Param("itemType") Integer itemType, @Param("start") Integer start, @Param("back") Integer back, @Param("cid") Integer cid,
                                         @Param("sort") Integer sort, @Param("companyId") Integer companyId);

    int updateGoodsTopStageByGoodsId(@Param("itemid") String itemid, @Param("itemTop") Integer itemTop);

    int updateGoodsTopByIdList(@Param("list") List<String> list, @Param("itemTop") String itemTop);

    List<AppGoods> selectAppGoodsByTaobaoImageIsNull();

    List<AppGoods> selectAppGoodsByItemId(Long itemNum);

    List<AppGoods> deleteAppGoodsListAll();

    int deleteByGoodsId(Long goodsId);

    List<AppGoods> selectAppGoodsListsNotFree(@Param("itemType") Integer itemType, @Param("start") Integer start, @Param("back") Integer back, @Param("cid") Integer cid,
                                              @Param("recommend") Integer recommend, @Param("sort") Integer sort, @Param("companyId") Integer companyId);

    List<AppGoods> selectAppGoodsFreeList(
            @Param("itemType") Integer itemType, @Param("cid") Integer cid, @Param("start") Integer start, @Param("back") Integer back, @Param("userId") Long userId, @Param("companyId") Integer companyId);

    int updateGoodTopNum(HashMap<String, Object> hashMap);

    int updateGoodsTopAndtopSerialNumber(@Param("itemid") String itemid, @Param("itemTop") Integer itemTop, @Param("topSerialNumber") Integer topSerialNumber);

    Integer selectCountByItemId(String itemId);

    Integer selectAppGoodsByAddUserId(String itemId);

    AppGoods selectByOrderId(Long orderId);

    int updateGoodsByItemId(@Param("itemId") String itemId, @Param("recommend") Integer recommend, @Param("activityType") String activityType, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<AppGoods> selectGoodsList(@Param("tableId") Integer minId, @Param("end") Integer end, @Param("cid") Integer cid);

    List<AppGoods> getUpdateItem(@Param("fanliUpdateTime") String minId, @Param("end") Integer end, @Param("cid") Integer cid);

    List<AppGoods> findItem(@Param("userId") Long userId, @Param("end") Integer end, @Param("updateTime") String updateTime, @Param("classifyId") Integer classifyId);

    List<AppGoods> selectItem(@Param("userId") Long userId, @Param("itemid") String itemid, @Param("classifyId") Integer classifyId);

    List<AppGoods> kingKongSonList(@Param("star") Integer star, @Param("end") Integer end, @Param("cid") Integer fqcat, @Param("labelCode") String labelCode);

    List<AppGoods> getTimePeriodGoods(@Param("startTime") String startTime, @Param("endTime") String endTime);

    int updateBatchByItemId(AppGoods appGoods);

    AppGoods selectAppGoodsByIdHitCount(@Param("itemId") Long itemId);

    Integer updateAppGoodsByIdHitCount(@Param("tableId") Long tableId, @Param("hitCount") int hotCount);

    Integer updateFreeGoods(@Param("itemId") String itemId, @Param("itemendprice") Double itemendprice, @Param("tkmoney") String tkmoney, @Param("itemprice") String itemprice, @Param("couponmoney") Double couponmoney);

    void deleteTljGoodsfree();

    List<AppGoods> selectRecommendGoods(@Param("start") Integer start, @Param("end") Integer end);

    List<AppGoods> selectRecommendGoodsAll();

    List<AppGoods> selectTljGoods();

    List<AppGoods> selectChannelGoods();

    Integer deleteAppGoodsByAddUser(@Param("addUserId") String addUserId, @Param("time") Date time);

    int updateGoods(@Param("sort") String sort, @Param("recommend") String recommend, @Param("cid") Integer cid);
}